package com.csun.cmny.provider.model.domain;

import com.csun.cmny.core.mybatis.BaseEntity;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.apache.ibatis.type.Alias;
import org.springframework.format.annotation.DateTimeFormat;

import javax.persistence.*;
import java.io.Serializable;
import java.util.Date;

@Data
@Table(name = "cn_dmc_csun_gateway_data")
@Alias(value = "dmcCsunGatewayData")
public class DmcGatewayData implements Serializable {

    private static final long serialVersionUID = -2143576043794221878L;

    /**
     * 设备Id
     */
    @Id
    @Column(name = "device_id")
    private Long deviceId;

    /**
     * 状态, offline-离线，online-在线
     */
    private String status;

    /**
     * 消息类型
     */
    @Column(name = "msg_type")
    private String msgType;

    /**
     * 网关编号
     */
    @Column(name = "netgate_no")
    private String netgateNo;

    /**
     * 传感器Id
     */
    @Column(name = "sensor_id")
    private Long sensorId;

    /**
     * 传感器编号
     */
    @Column(name = "sensor_no")
    private String sensorNo;

    /**
     * 创建时间
     */
    @Column(name = "created_time")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date createdTime;

    /**
     * 更新时间
     */
    @Column(name = "update_time")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date updateTime;

    @JsonIgnore
    @Transient
    private Integer count;
}